home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIObjectOutputStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  9KB  |  220 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIObjectOutputStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIObjectOutputStream_h__
  6. #define __gen_nsIObjectOutputStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsIBinaryOutputStream_h__
  10. #include "nsIBinaryOutputStream.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsrootidl_h__
  14. #include "nsrootidl.h"
  15. #endif
  16.  
  17. /* For IDL files that don't want to include root IDL files. */
  18. #ifndef NS_NO_VTABLE
  19. #define NS_NO_VTABLE
  20. #endif
  21.  
  22. /* starting interface:    nsIObjectOutputStream */
  23. #define NS_IOBJECTOUTPUTSTREAM_IID_STR "92c898ac-5fde-4b99-87b3-5d486422094b"
  24.  
  25. #define NS_IOBJECTOUTPUTSTREAM_IID \
  26.   {0x92c898ac, 0x5fde, 0x4b99, \
  27.     { 0x87, 0xb3, 0x5d, 0x48, 0x64, 0x22, 0x09, 0x4b }}
  28.  
  29. /**
  30.  * @See nsIObjectInputStream
  31.  * @See nsIBinaryOutputStream
  32.  */
  33. class NS_NO_VTABLE nsIObjectOutputStream : public nsIBinaryOutputStream {
  34.  public: 
  35.  
  36.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBJECTOUTPUTSTREAM_IID)
  37.  
  38.   /**
  39.      * Write the object whose "root" or XPCOM-identity nsISupports is aObject.
  40.      * The cause for writing this object is a strong or weak reference, so the
  41.      * aIsStrongRef argument must tell which kind of pointer is being followed
  42.      * here during serialization.
  43.      *
  44.      * If the object has only one strong reference in the serialization and no
  45.      * weak refs, use writeSingleRefObject.  This is a valuable optimization:
  46.      * it saves space in the stream, and cycles on both ends of the process.
  47.      *
  48.      * If the reference being serialized is a pointer to an interface not on
  49.      * the primary inheritance chain ending in the root nsISupports, you must
  50.      * call writeCompoundObject instead of this method.
  51.      */
  52.   /* void writeObject (in nsISupports aObject, in PRBool aIsStrongRef); */
  53.   NS_IMETHOD WriteObject(nsISupports *aObject, PRBool aIsStrongRef) = 0;
  54.  
  55.   /**
  56.      * Write an object referenced singly and strongly via its root nsISupports
  57.      * or a subclass of its root nsISupports.  There must not be other refs to
  58.      * aObject in memory, or in the serialization.
  59.      */
  60.   /* void writeSingleRefObject (in nsISupports aObject); */
  61.   NS_IMETHOD WriteSingleRefObject(nsISupports *aObject) = 0;
  62.  
  63.   /**
  64.      * Write the object referenced by an interface pointer at aObject that
  65.      * inherits from a non-primary nsISupports, i.e., a reference to one of
  66.      * the multiply inherited interfaces derived from an nsISupports other
  67.      * than the root or XPCOM-identity nsISupports; or a reference to an
  68.      * inner object in the case of true XPCOM aggregation.  aIID identifies
  69.      * this interface.
  70.      */
  71.   /* void writeCompoundObject (in nsISupports aObject, in nsIIDRef aIID, in PRBool aIsStrongRef); */
  72.   NS_IMETHOD WriteCompoundObject(nsISupports *aObject, const nsIID & aIID, PRBool aIsStrongRef) = 0;
  73.  
  74.   /* void writeID (in nsIDRef aID); */
  75.   NS_IMETHOD WriteID(const nsID & aID) = 0;
  76.  
  77.   /**
  78.      * Optimized serialization support -- see nsIStreamBufferAccess.idl.
  79.      */
  80.   /* [notxpcom] charPtr getBuffer (in PRUint32 aLength, in PRUint32 aAlignMask); */
  81.   NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) = 0;
  82.  
  83.   /* [notxpcom] void putBuffer (in charPtr aBuffer, in PRUint32 aLength); */
  84.   NS_IMETHOD_(void) PutBuffer(char * aBuffer, PRUint32 aLength) = 0;
  85.  
  86. };
  87.  
  88. /* Use this macro when declaring classes that implement this interface. */
  89. #define NS_DECL_NSIOBJECTOUTPUTSTREAM \
  90.   NS_IMETHOD WriteObject(nsISupports *aObject, PRBool aIsStrongRef); \
  91.   NS_IMETHOD WriteSingleRefObject(nsISupports *aObject); \
  92.   NS_IMETHOD WriteCompoundObject(nsISupports *aObject, const nsIID & aIID, PRBool aIsStrongRef); \
  93.   NS_IMETHOD WriteID(const nsID & aID); \
  94.   NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask); \
  95.   NS_IMETHOD_(void) PutBuffer(char * aBuffer, PRUint32 aLength); 
  96.  
  97. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  98. #define NS_FORWARD_NSIOBJECTOUTPUTSTREAM(_to) \
  99.   NS_IMETHOD WriteObject(nsISupports *aObject, PRBool aIsStrongRef) { return _to WriteObject(aObject, aIsStrongRef); } \
  100.   NS_IMETHOD WriteSingleRefObject(nsISupports *aObject) { return _to WriteSingleRefObject(aObject); } \
  101.   NS_IMETHOD WriteCompoundObject(nsISupports *aObject, const nsIID & aIID, PRBool aIsStrongRef) { return _to WriteCompoundObject(aObject, aIID, aIsStrongRef); } \
  102.   NS_IMETHOD WriteID(const nsID & aID) { return _to WriteID(aID); } \
  103.   NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) { return _to GetBuffer(aLength, aAlignMask); } \
  104.   NS_IMETHOD_(void) PutBuffer(char * aBuffer, PRUint32 aLength) { return _to PutBuffer(aBuffer, aLength); } 
  105.  
  106. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  107. #define NS_FORWARD_SAFE_NSIOBJECTOUTPUTSTREAM(_to) \
  108.   NS_IMETHOD WriteObject(nsISupports *aObject, PRBool aIsStrongRef) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteObject(aObject, aIsStrongRef); } \
  109.   NS_IMETHOD WriteSingleRefObject(nsISupports *aObject) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteSingleRefObject(aObject); } \
  110.   NS_IMETHOD WriteCompoundObject(nsISupports *aObject, const nsIID & aIID, PRBool aIsStrongRef) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteCompoundObject(aObject, aIID, aIsStrongRef); } \
  111.   NS_IMETHOD WriteID(const nsID & aID) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteID(aID); } \
  112.   NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBuffer(aLength, aAlignMask); } \
  113.   NS_IMETHOD_(void) PutBuffer(char * aBuffer, PRUint32 aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->PutBuffer(aBuffer, aLength); } 
  114.  
  115. #if 0
  116. /* Use the code below as a template for the implementation class for this interface. */
  117.  
  118. /* Header file */
  119. class nsObjectOutputStream : public nsIObjectOutputStream
  120. {
  121. public:
  122.   NS_DECL_ISUPPORTS
  123.   NS_DECL_NSIOBJECTOUTPUTSTREAM
  124.  
  125.   nsObjectOutputStream();
  126.  
  127. private:
  128.   ~nsObjectOutputStream();
  129.  
  130. protected:
  131.   /* additional members */
  132. };
  133.  
  134. /* Implementation file */
  135. NS_IMPL_ISUPPORTS1(nsObjectOutputStream, nsIObjectOutputStream)
  136.  
  137. nsObjectOutputStream::nsObjectOutputStream()
  138. {
  139.   /* member initializers and constructor code */
  140. }
  141.  
  142. nsObjectOutputStream::~nsObjectOutputStream()
  143. {
  144.   /* destructor code */
  145. }
  146.  
  147. /* void writeObject (in nsISupports aObject, in PRBool aIsStrongRef); */
  148. NS_IMETHODIMP nsObjectOutputStream::WriteObject(nsISupports *aObject, PRBool aIsStrongRef)
  149. {
  150.     return NS_ERROR_NOT_IMPLEMENTED;
  151. }
  152.  
  153. /* void writeSingleRefObject (in nsISupports aObject); */
  154. NS_IMETHODIMP nsObjectOutputStream::WriteSingleRefObject(nsISupports *aObject)
  155. {
  156.     return NS_ERROR_NOT_IMPLEMENTED;
  157. }
  158.  
  159. /* void writeCompoundObject (in nsISupports aObject, in nsIIDRef aIID, in PRBool aIsStrongRef); */
  160. NS_IMETHODIMP nsObjectOutputStream::WriteCompoundObject(nsISupports *aObject, const nsIID & aIID, PRBool aIsStrongRef)
  161. {
  162.     return NS_ERROR_NOT_IMPLEMENTED;
  163. }
  164.  
  165. /* void writeID (in nsIDRef aID); */
  166. NS_IMETHODIMP nsObjectOutputStream::WriteID(const nsID & aID)
  167. {
  168.     return NS_ERROR_NOT_IMPLEMENTED;
  169. }
  170.  
  171. /* [notxpcom] charPtr getBuffer (in PRUint32 aLength, in PRUint32 aAlignMask); */
  172. NS_IMETHODIMP_(char *) nsObjectOutputStream::GetBuffer(PRUint32 aLength, PRUint32 aAlignMask)
  173. {
  174.     return NS_ERROR_NOT_IMPLEMENTED;
  175. }
  176.  
  177. /* [notxpcom] void putBuffer (in charPtr aBuffer, in PRUint32 aLength); */
  178. NS_IMETHODIMP_(void) nsObjectOutputStream::PutBuffer(char * aBuffer, PRUint32 aLength)
  179. {
  180.     return NS_ERROR_NOT_IMPLEMENTED;
  181. }
  182.  
  183. /* End of implementation class template. */
  184. #endif
  185.  
  186. inline nsresult
  187. NS_WriteOptionalObject(nsIObjectOutputStream* aStream, nsISupports* aObject,
  188.                        PRBool aIsStrongRef)
  189. {
  190.     PRBool nonnull = (aObject != nsnull);
  191.     nsresult rv = aStream->WriteBoolean(nonnull);
  192.     if (NS_SUCCEEDED(rv) && nonnull)
  193.         rv = aStream->WriteObject(aObject, aIsStrongRef);
  194.     return rv;
  195. }
  196. inline nsresult
  197. NS_WriteOptionalSingleRefObject(nsIObjectOutputStream* aStream,
  198.                                 nsISupports* aObject)
  199. {
  200.     PRBool nonnull = (aObject != nsnull);
  201.     nsresult rv = aStream->WriteBoolean(nonnull);
  202.     if (NS_SUCCEEDED(rv) && nonnull)
  203.         rv = aStream->WriteSingleRefObject(aObject);
  204.     return rv;
  205. }
  206. inline nsresult
  207. NS_WriteOptionalCompoundObject(nsIObjectOutputStream* aStream,
  208.                                nsISupports* aObject,
  209.                                const nsIID& aIID,
  210.                                PRBool aIsStrongRef)
  211. {
  212.     PRBool nonnull = (aObject != nsnull);
  213.     nsresult rv = aStream->WriteBoolean(nonnull);
  214.     if (NS_SUCCEEDED(rv) && nonnull)
  215.         rv = aStream->WriteCompoundObject(aObject, aIID, aIsStrongRef);
  216.     return rv;
  217. }
  218.  
  219. #endif /* __gen_nsIObjectOutputStream_h__ */
  220.